<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreatePersonInfosTable extends Migration
{
    /**
     * Run the migrations.
     * person information management
     * @return void
     */
    public function up()
    {
        Schema::create('person_infos', function (Blueprint $table) {
            $table->increments('id');
            $table->integer('employee_id')->unsigned()->comment('员工ID')->nullable();
            $table->foreign('employee_id')->references('id')->on('employees')->onDelete('set null');
            $table->integer('banci_id')->unsigned()->comment('班次ID')->nullable();
            $table->foreign('banci_id')->references('id')->on('bancis')->onDelete('set null');
            $table->integer('workspace')->unsigned()->comment('作业区域 1组内作业 2临时作业')->default(1);
            $table->softDeletes();
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('person_infos');
    }
}
